Skip to content

feat: temporal validation of alerts on pi - #415

Open
MateoLostanlen wants to merge 11 commits into
developfrom
feat/temporal-validator
Open

feat: temporal validation of alerts on pi#415
MateoLostanlen wants to merge 11 commits into
developfrom
feat/temporal-validator

Conversation

@MateoLostanlen

@MateoLostanlen MateoLostanlen commented Sep 8, 2026

Copy link
Copy Markdown
Member
  • Alerts are only uploaded once the temporal smoke model confirms them: when an alert becomes ongoing, the engine sends the last frames and boxes of the camera pose to pyro_temporal_api and reads the verdict on the next round. A negative verdict resubmits with the new frame, a service error fails open.
  • The service runs the torch-free ONNX runtime from temporal-model (feat: ONNX export and torch-free runtime for the tube classifier temporal-model#76, merged, pinned to commit fb7f6ca until a release ships model_onnx.zip), behind the compose profile temporal. Unset TEMPORAL_API_URL keeps today's behaviour.
  • model_onnx.zip must be exported from the merged code: the graph now has a dynamic batch axis and older exports fail with more than one tube.
  • Engine and camera API images move to bookworm since bullseye's security repo no longer resolves.

Tested on a Pi 5 with a fake box injected on two poses: verdicts, hold and upload work as expected. Scoring takes about 8 s per job at 2.5 cores, the service uses about 1 GB of RAM.

…X temporal model

POST /jobs takes a window of frames plus YOLO boxes for one camera pose
and returns a job id at once; a worker thread scores it with
OnnxTemporalModel and GET /jobs/{id} serves the verdict. No torch.
With TEMPORAL_API_URL set, the engine keeps the last 10 inference frames
and boxes per camera pose, submits them when an alert becomes ongoing and
reads the verdict on the next round. Negative verdicts resubmit the
longer window; service errors fail open.
bullseye LTS ended in August 2026: its security repo now serves an
expired release file and apt-get update fails in every build.
…ge, compose profile

Per-frame size limit and pending-job cap on POST /jobs, service bound to
127.0.0.1 on the host network, image added to the build-and-push matrix
so make run can pull it, and the service placed behind the temporal
compose profile so disabled stacks do not start it.
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.23529% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.88%. Comparing base (968284f) to head (a87b779).
⚠️ Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
pyroengine/temporal_client.py 57.89% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #415      +/-   ##
===========================================
+ Coverage    78.83%   80.88%   +2.04%     
===========================================
  Files            6        7       +1     
  Lines          841      905      +64     
===========================================
+ Hits           663      732      +69     
+ Misses         178      173       -5     
Flag Coverage Δ
unittests 80.88% <88.23%> (+2.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MateoLostanlen MateoLostanlen changed the title feat: temporal validation of alerts through a sidecar service feat: temporal validation of alerts Sep 12, 2026
@MateoLostanlen MateoLostanlen changed the title feat: temporal validation of alerts feat: temporal validation of alerts on pi Sep 12, 2026
An event ending while the temporal job was pending was dropped by _end_event,
so a positive verdict never uploaded the frames held during scoring. The state
now survives until the verdict: positive stages the held frames, negative drops
the event without resubmitting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant